# 序列化组织架构数据
from rest_framework import serializers

from apps.config.models import Menu_model, Dept_model


class Menu_serializer(serializers.ModelSerializer):
    # 这里是序列化成前端需要的字段，非常好使
    title = serializers.CharField(source='tree_name', read_only=True)
    class Meta:
        model = Menu_model
        fields = "__all__"



class Dept_serializer(serializers.ModelSerializer):
    tree_name=serializers.CharField(source='dept_name',read_only=True)
    class Meta:
        model = Dept_model
        fields = "__all__"

